// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie;

import java.io.File;
import java.util.concurrent.ConcurrentHashMap;
import zombie.core.Core;

public final class ChunkMapFilenames {
    public static zombie.ChunkMapFilenames instance = new zombie.ChunkMapFilenames();
    public final ConcurrentHashMap<Long, Object> Map = new ConcurrentHashMap();
    public final ConcurrentHashMap<Long, Object> HeaderMap = new ConcurrentHashMap();
    String prefix = "map_";
    private File dirFile;
    private String cacheDir;

    public void clear() {
        this.dirFile = null;
        this.cacheDir = null;
        this.Map.clear();
        this.HeaderMap.clear();
    }

    public File getFilename(int wx, int wy) {
        long _long = (long)wx << 32 | (long)wy;
        if (this.Map.containsKey(_long)) {
            return (File)this.Map.get(_long);
        } else {
            if (this.cacheDir == null) {
                this.cacheDir = zombie.ZomboidFileSystem.instance.getGameModeCacheDir();
            }

            String string = this.cacheDir + File.separator + Core.GameSaveWorld + File.separator + this.prefix + wx + "_" + wy + ".bin";
            File file = new File(string);
            this.Map.put(_long, file);
            return file;
        }
    }

    public File getDir(String gameSaveWorld) {
        if (this.cacheDir == null) {
            this.cacheDir = zombie.ZomboidFileSystem.instance.getGameModeCacheDir();
        }

        if (this.dirFile == null) {
            this.dirFile = new File(this.cacheDir + File.separator + gameSaveWorld);
        }

        return this.dirFile;
    }

    public String getHeader(int wX, int wY) {
        long _long = (long)wX << 32 | (long)wY;
        if (this.HeaderMap.containsKey(_long)) {
            return this.HeaderMap.get(_long).toString();
        } else {
            String string = wX + "_" + wY + ".lotheader";
            this.HeaderMap.put(_long, string);
            return string;
        }
    }
}
